<template>
    <!-- 本月购买会员记录查询 -->
    <!-- 王旭 2023年8月28日11:04:16 -->
    <div>
        <div>
        <!-- 头部按钮模块 -->
            <el-row :gutter="10" class="mb8">
                <el-col :span="1.5">
                <el-button
                  type="primary"
                  plain
                  icon="el-icon-refresh-left"
                  size="mini"
                  @click="handleRest"
                  >返回</el-button
                >
              </el-col>
            </el-row>
                <el-table
              v-loading="loading"
              :data="menberShipList"
              :header-cell-class-name="'headerBg'"
              class="bold-header"
            >
            <el-table-column label="订单编号" align="center" prop="memberNumber" />
            <el-table-column label="会员类型名称" align="center" prop="memberName" />
            <el-table-column label="购买用户" align="center" prop="frontDeskName" />
            <el-table-column label="支付金额" align="center" prop="payPrice" />
            <el-table-column label="开通时间" align="center" prop="createTime" />
            <el-table-column label="到期时间" align="center" prop="expiryTime" />
            </el-table>
            <!--分页效果-->
            <el-pagination
              @size-change="handleSizeChange"
              @current-change="handleCurrentChange"
              :current-page="currentPage4"
              :page-sizes="[10, 15, 20, 25]"
              :page-size="pageSize"
              layout="total, sizes, prev, pager, next, jumper"
              :total="total"
            >
            </el-pagination>
        </div>
    </div>
</template>
<script>
export default {
    data () {
        return {
            // 总条数
            total: 0,
            // 当前页码
             currentPage4: 1,
            // 第几页
            pageNum: 1,
            // 每页条数
            pageSize: 10,
            // 遮罩层
            loading: true,
            // 表格数据
            menberShipList: []
        }
    },
    created () {
        this.getList()
    },
    methods : {
        // 返回操作
        handleRest () {
            this.$router.push('/memberManger')
        },
        // 全查操作
        getList() {
          const that = this;
          this.loading = true;
          this.$axios
            .post("/memberShip/selectMemberShip", {
              pageNum: that.pageNum,
              pageSize: that.pageSize,
            })
            .then((res) => {
              this.menberShipList = res.data.data.content;
              this.total = res.data.data.totalSize;
              this.loading = false;
            });
        },
        // 分页每页条数显示
        handleSizeChange(val) {
          this.pageSize = val;
          this.getList();
          console.log(`每页 ${val} 条`);
        },
        // 分页当前页显示
        handleCurrentChange(val) {
          this.currentPage4 = val;
          this.pageNum = val;
          this.getList();
          console.log(`当前页: ${val}`);
        },
        }
}
</script>
<style scoped>
.headerBg {
  background: #eee !important;
}
</style>